﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;

namespace SQLiteDictionary
{
    public enum SQLiteDictionaryStorage
    {
        AppData,
        LocalAppData,
        MyDocuments,
    }

    public class StorageLocal
    {
        public static string GetPath(SQLiteDictionaryStorage Storage, string DataBaseName)
        {

            string PATH = "";

            switch (Storage)
            {
                case SQLiteDictionaryStorage.AppData:
                    string mydir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                    PATH = Path.Combine(mydir, DataBaseName);
                    break;

                case SQLiteDictionaryStorage.LocalAppData:
                    string mydir2 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                    PATH = Path.Combine(mydir2, DataBaseName);
                    break;

                case SQLiteDictionaryStorage.MyDocuments:
                    string mydir3 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    PATH = Path.Combine(mydir3, DataBaseName);
                    break;
            }

            string DIR = Path.GetDirectoryName(PATH);
            if (!Directory.Exists(DIR))
                Directory.CreateDirectory(DIR);

            return PATH;
        }
    }
}
